package edu.neu.springcloud.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@NoArgsConstructor
@Accessors(chain = true)  //支持链式写法
@ToString
public class CommodityVo implements Serializable {  //分布式中的实体类需要实现序列化接口，方便网络传输

    private Long id;
    private Long fac_id;
    private String fac_name;
    private String name;
    private String description;
    private Float price;

    public CommodityVo(Commodity commodity, String fac_name){
        this.id = commodity.getId();
        this.fac_id = commodity.getFac_id();
        this.name = commodity.getName();
        this.description = commodity.getDescription();
        this.fac_name = fac_name;
        this.price = commodity.getPrice();
    }
}
